In U-boot, serial_tstc was use to determine is there have a character in
serial console that pending for read. If there is no "pending" function
implemented in serial driver, the serial-uclass will return "true(1)"
to indicate there have a character pending to read.
Thus, read a character from nulldev serial will result in continuous
getting -EAGAIN return which might lead system to hang.
This commit is to fix a bug in nulldev serial which implement "pending"
function in nulldev serial to always indicate there is no character in
console that pending for read.
Signed-off-by: Wilson Lee <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Keng Soon Cheah <[email protected]>
Cc: Chen Yee Chew <[email protected]>
Cc: Bin Meng <[email protected]>
return -EAGAIN;
}
+static int nulldev_serial_pending(struct udevice *dev, bool input)
+{
+ return 0;
+}
+
static int nulldev_serial_input(struct udevice *dev)
{
return 0;
const struct dm_serial_ops nulldev_serial_ops = {
.putc = nulldev_serial_putc,
+ .pending = nulldev_serial_pending,
.getc = nulldev_serial_getc,
.setbrg = nulldev_serial_setbrg,
};